/**
 * Copyright 2025 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

.tray {
    --spectrum-tray-max-inline-size: var(--mod-tray-max-inline-size, 375px);
    --spectrum-tray-spacing-edge-to-tray-safe-zone: var(--mod-tray-spacing-edge-to-tray-safe-zone, 64px);
    --spectrum-tray-entry-animation-delay: var(--mod-tray-entry-animation-delay, 0.16s);
    --spectrum-tray-entry-animation-duration: var(--mod-tray-entry-animation-duration, var(--spectrum-animation-duration-500));
    --spectrum-tray-exit-animation-delay: var(--mod-tray-exit-animation-delay, 0s);
    --spectrum-tray-exit-animation-duration: var(--mod-tray-exit-animation-duration, var(--spectrum-animation-duration-100));
    --spectrum-tray-corner-radius: var(--mod-tray-corner-radius, var(--spectrum-corner-radius-100));
    --spectrum-tray-background-color: var(--highcontrast-tray-background-color, var(--mod-tray-background-color, var(--spectrum-background-layer-2-color)));
    --mod-modal-max-width: 100%;
    inline-size: 100%;
    max-inline-size: 100%;
    max-block-size: calc(100vh - 64px);
    max-block-size: calc(100vh - var(--spectrum-tray-spacing-edge-to-tray-safe-zone));
    box-sizing: border-box;
    border-radius: 0;
    border-radius: var(--mod-tray-corner-radius-portrait, 0) var(--mod-tray-corner-radius-portrait, 0) 0 0;
    transition:
        opacity var(--spectrum-tray-exit-animation-duration) cubic-bezier(0.5, 0, 1, 1) 0s,
        visibility var(--spectrum-tray-exit-animation-duration) linear calc(var(--spectrum-tray-exit-animation-duration)),
        transform var(--spectrum-tray-exit-animation-duration) cubic-bezier(0.5, 0, 1, 1) 0s;
    transition:
        opacity var(--spectrum-tray-exit-animation-duration) cubic-bezier(0.5, 0, 1, 1) var(--spectrum-tray-exit-animation-delay),
        visibility var(--spectrum-tray-exit-animation-duration) linear calc(var(--spectrum-tray-exit-animation-delay) + var(--spectrum-tray-exit-animation-duration)),
        transform var(--spectrum-tray-exit-animation-duration) cubic-bezier(0.5, 0, 1, 1) var(--spectrum-tray-exit-animation-delay);
    background-color: var(--spectrum-tray-background-color);
    outline: none;
    margin-block-start: var(--spectrum-tray-spacing-edge-to-tray-safe-zone);
    padding-block-start: var(--mod-tray-top-to-content-area, var(--spectrum-tray-top-to-content-area));
    padding-block-end: var(--mod-tray-bottom-to-content-area, var(--spectrum-tray-top-to-content-area));
    overflow: auto;
    transform: translateY(100%);
}

:host([open]) .tray {
    transition:
        transform var(--spectrum-tray-entry-animation-duration) cubic-bezier(0, 0, 0.4, 1) var(--spectrum-tray-entry-animation-delay),
        opacity var(--spectrum-tray-entry-animation-duration) cubic-bezier(0, 0, 0.4, 1) var(--spectrum-tray-entry-animation-delay);
    transform: translateY(0);
}

@media screen and (orientation: landscape) {
    .tray {
        max-inline-size: var(--spectrum-tray-max-inline-size);
        border-start-start-radius: var(--spectrum-tray-corner-radius);
        border-start-end-radius: var(--spectrum-tray-corner-radius);
    }
}

@media (forced-colors: active) {
    .tray {
        --highcontrast-tray-background-color: Canvas;
        border: solid;
    }

    .tray ::slotted(*) {
        border: none;
    }
}
